﻿Public Class credentials





    Private Sub okButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click
        'set resources
        My.Settings.userName = Me.TextBox1.Text
        My.Settings.password = Me.TextBox2.Text

        'test it first!
        Dim test As Boolean = False
        Dim sqlstr As String = "SELECT accession_id FROM ACCESSION LIMIT 1"
        Try
            Dim x As Integer = XBRL.executeScalar(sqlstr)
            test = True
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
            Me.Close()

        Catch ex As Exception
            MsgBox("Credential test failed")
            test = False
            My.Settings.userName = ""
            My.Settings.password = ""

        End Try


    End Sub



End Class